//
//  TopGestureView.m
//  GestureTest
//
//  Created by 谭伟 on 2017/3/10.
//  Copyright © 2017年 迷你贷. All rights reserved.
//

#import "TopGestureView.h"

@interface TopGestureView()
/*  */
//@property (strong, nonatomic) <#Class#> *<#name#>;
@end

@implementation TopGestureView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    
    if ([super initWithFrame:frame]) {
        
        [self setupUI];
        
    }
    return self;
}

#pragma mark -搭建界面

- (void)setupUI {
    
    _selectBtnArr = [[NSMutableArray alloc]initWithCapacity:0];
    self.backgroundColor = [UIColor whiteColor];
    //_selectBtnArr = [[NSMutableArray alloc]initWithCapacity:0];
    CGFloat btnMargin =  10;
    CGFloat btnWH = (60-btnMargin*2)/3;
        
    for (int i = 0; i < 9; i++) {
    int row = i/3;
    int cloum = i%3;
    //循环创建9个按钮并布局
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake((btnWH+btnMargin)*row, (btnWH+btnMargin)*cloum, btnWH, btnWH)];
    //把按钮设置为圆形
//    [btn.layer setCornerRadius:btnWH*0.5];
    
//    btn.layer.masksToBounds = YES;
    btn.userInteractionEnabled = NO;
    [btn setImage:[UIImage imageNamed:@"top_Gesture_Normal"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"top_Gesture_Highlight"] forState:UIControlStateSelected];
    btn.tag = i+1;
    [self addSubview:btn];
}
    
}


@end
